


<body>

<!--Search Area  -->	  
  <div class="body" id="dummyParent_root">
	<fieldset>
			<legend>查询条件</legend>
			<form id="dummyParent_search">
				<table>
				<tr class="prop">
					<td valign="top" class="name" width="18%">
	                   <label for="name">Name:</label>
	                </td>
	                <td valign="top" width="32%">
	                   <input type="text" name="name_mask" id="item_name" onkeydown="doSearch(arguments[0]||event)" />
	                	<input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)">
						允许自动搜索 <br/>
	                </td>
				</tr>
				<tr class="prop">
					<td valign="top" class="name" width="18%">
	                   <label for="name">Name2:</label>
	                </td>
	                <td valign="top"  width="32%">
	                  <input type="text" id="item_name2" name="name_mask2" onkeydown="doSearch(arguments[0]||event)" />
	                </td>
				</tr>
				</table>
			<!--Button Area -->		
			<div id='dummyParent_buttons' class="buttons" align="right">
                <input  id="dummyParent_button_search" name="2" type="button" value="查询" class="formbutton" />
                <input type="reset" value="重置" class="formbutton" />
               	<input  id="dummyParent_button_create" type="button" value="新建" class="formbutton" name="1" />
               	<input  id="dummyParent_button_edit" type="button" value="修改" class="formbutton" name="3" />
                <input  id="dummyParent_button_view" type="button" value="详细" class="formbutton" name="5"/>
                <input  id="dummyParent_button_delete" type="button" value="删除" class="formbutton" name="4"/>
            </div>						
			<!--Button Area end-->					
	</form>
	</fieldset>
<!--Search Area end-->	

<!--List Area -->
           
     <div id="dummyParent_list">
		 <table id="dummyParent_list2" class="scroll" cellpadding="0" cellspacing="0"></table> 
		 <div id="dummyParent_pager2" class="scroll" style="text-align:center;"></div> 
	 </div>		
	
<!--List Area end -->	
	
<!--dialog Area -->
 <div id="dummyParent_dialog">
	<input type="hidden" id="dummyParent_id" value=""/>
	<input type="hidden" id="dummyParent_action" value=""/>
	<form id="dummyParent_dailog_form">
                  <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="name">Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name" name="name" value="${fieldValue(bean:dummyParentInstance,field:'name')}"/>
                                </td>
						
                                <td valign="top" class="name" width="18%">
                                    <label for="name10">Name10:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name10','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name10" name="name10" value="${fieldValue(bean:dummyParentInstance,field:'name10')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="name2">Name2:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name2','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name2" name="name2" value="${fieldValue(bean:dummyParentInstance,field:'name2')}"/>
                                </td>
						
                                <td valign="top" class="name" width="18%">
                                    <label for="name3">Name3:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name3','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name3" name="name3" value="${fieldValue(bean:dummyParentInstance,field:'name3')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="name4">Name4:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name4','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name4" name="name4" value="${fieldValue(bean:dummyParentInstance,field:'name4')}"/>
                                </td>
						
                                <td valign="top" class="name" width="18%">
                                    <label for="name5">Name5:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name5','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name5" name="name5" value="${fieldValue(bean:dummyParentInstance,field:'name5')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="name6">Name6:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name6','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name6" name="name6" value="${fieldValue(bean:dummyParentInstance,field:'name6')}"/>
                                </td>
						
                                <td valign="top" class="name" width="18%">
                                    <label for="name7">Name7:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name7','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name7" name="name7" value="${fieldValue(bean:dummyParentInstance,field:'name7')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name" width="18%">
                                    <label for="name8">Name8:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name8','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name8" name="name8" value="${fieldValue(bean:dummyParentInstance,field:'name8')}"/>
                                </td>
						
                                <td valign="top" class="name" width="18%">
                                    <label for="name9">Name9:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:dummyParentInstance,field:'name9','errors')}" width="32%">
                                    <input type="text" id="dummyParent_name9" name="name9" value="${fieldValue(bean:dummyParentInstance,field:'name9')}"/>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
              </form>
 </div>
	
<!--dialog Area end -->	


</div>

</body>

<!--js area -->		
			<script type="text/javascript"><!--
		jQuery(document).ready(function(){
		  var	allFields=jQuery('#dummyParent_dailog_form input');
				allFields.val();
			//jQuery(allFields).each(function(){alert(jQuery(this).attr('id'));});
		  var	tips = jQuery("#dummyParent_validateTips");
				jQuery("#dummyParent_dialog").dialog({
				title: '创建***',
				bgiframe: true,
				autoOpen: false,
				height: 300,
				width:600,
				position:'top',
				modal: true,
				buttons: {

					'取消': function() {
					jQuery(this).dialog('close');
				},
				
					'保存': function() {
						var bValid = true;
						var params ;
						var id=jQuery('#dummyParent_id').val();
						var action=jQuery('#dummyParent_action').val();
						params= jQuery('#dummyParent_dailog_form').serialize()+'&id='+id;
						allFields.removeClass('ui-state-error');
						
						if (bValid) {
							//ajax save
							if(action=='c'){
									jQuery.post('dummyParent/save',params,function(s){});
							}
							if(action=='u')

							{
								jQuery.post('dummyParent/update',params,function(s){});
							}
							if(action=='v')
								jQuery(this).dialog('close');
							jQuery(this).dialog('close');
							gridReload();
						}
					}
					
				},
				close: function() {
					allFields.val('').removeClass('ui-state-error');
				}
			});
			//open
			
			
			//button click	
		    jQuery('#dummyParent_buttons :button').click(function(){
				var index=0;
				index=parseInt(jQuery(this).attr('name'));
			
				switch(index)
				{
				//create
				case 1:
					jQuery('#dummyParent_id').val();
					jQuery('#dummyParent_action').val('c');
					jQuery('#dummyParent_dialog').dialog('option', 'title', '新建');
					jQuery('#dummyParent_dialog').dialog('open');
					
				break;
				//inquery
				case 2:
					gridReload();
				break;
				//update
				case 3:
					//jQuery('dummyParent_dailog_form #id').val(1);
					jQuery('#dummyParent_action').val('u');
					jQuery('#dummyParent_dialog').dialog('option', 'title', '编辑');
					doShow();
					jQuery('#dummyParent_dialog').dialog('open');
				break;
				//delete
				case 4: 
					if(confirm('确定删除数据？'))
					{
						
						jQuery.post('dummyParent/delete',{id:jQuery('#dummyParent_id').val()},function(s){
								
								if(s){
									alert("删除成功！");
									gridReload();	
									}
								else
									{alert("删除失败！");}
								gridReload();			
							});	
					}
					
				break;
				//view
				case 5:
					jQuery('#dummyParent_action').val('v');
					jQuery('#dummyParent_dialog').dialog('option', 'title', '查看');
					doShow();
					jQuery('#dummyParent_dialog').dialog('open');
					
				break;	
				default:
					alert('default');
				break;
				};
		    }).hover(
					function(){ 
						jQuery(this).addClass("ui-state-hover"); 
					},
					function(){ 
						jQuery(this).removeClass("ui-state-hover"); 
					}
				).mousedown(function(){
					jQuery(this).addClass("ui-state-active"); 
				})
				.mouseup(function(){
						jQuery(this).removeClass("ui-state-active");
				});
		function doShow()
			{
			     jQuery.post('dummyParent/show',{id:jQuery('#dummyParent_id').val()},function(json){

			    	 
							jQuery('#dummyParent_name').val(json.name);
						
							jQuery('#dummyParent_name10').val(json.name10);
						
							jQuery('#dummyParent_name2').val(json.name2);
						
							jQuery('#dummyParent_name3').val(json.name3);
						
							jQuery('#dummyParent_name4').val(json.name4);
						
							jQuery('#dummyParent_name5').val(json.name5);
						
							jQuery('#dummyParent_name6').val(json.name6);
						
							jQuery('#dummyParent_name7').val(json.name7);
						
							jQuery('#dummyParent_name8').val(json.name8);
						
							jQuery('#dummyParent_name9').val(json.name9);
						
			     },'json');
					  
			};
	//List 
	jQuery("#dummyParent_list2").jqGrid({
				url: 'dummyParent/jsonList',
				//width:1200,
				datatype:"json",
				colNames:[ 
		                         'id',//width:auto
								
		                         'name',//width:auto
								
		                         'name10',//width:auto
								
		                         'name2',//width:auto
								
		                         'name3',//width:auto
								
		                         'name4',//width:auto
								
		                         'name5',//width:auto
								
		                         'name6',//width:auto
								
		                         'name7',//width:auto
								
		                         'name8',//width:auto
								
		                         'name9'//width:auto
								],
				colModel:[
						{name:'id',index:'id',  sortable:true,hidden:true},
						 
                         {name:'name',index:'name', sortable:true},//width:auto
						
                         {name:'name10',index:'name10', sortable:true},//width:auto
						
                         {name:'name2',index:'name2', sortable:true},//width:auto
						
                         {name:'name3',index:'name3', sortable:true},//width:auto
						
                         {name:'name4',index:'name4', sortable:true},//width:auto
						
                         {name:'name5',index:'name5', sortable:true},//width:auto
						
                         {name:'name6',index:'name6', sortable:true},//width:auto
						
                         {name:'name7',index:'name7', sortable:true},//width:auto
						
                         {name:'name8',index:'name8', sortable:true},//width:auto
						
                         {name:'name9',index:'name9', sortable:true}//width:auto
						
						],
				rowNum:10,
				rowList:[10,20,50],
				height:250,
				autowidth: true,
				rownumbers: true,
				imgpath: "${resource(dir:'js/images', file:'')}",
				pager: jQuery('#dummyParent_pager2'), 
				sortorder: 'asc',
				sortname: 'name',
				viewrecords: true,
				autoencode: true,
				caption:"查询结果",
				onSelectRow:function(id){
								
							    var rd=jQuery('#dummyParent_list2').getRowData(id); 
								
								jQuery('#dummyParent_id').val(rd.id);
				}
				
				}).navGrid('#dummyParent_pager2',{edit:false,add:true,del:false});		
			});
				var timeoutHnd;
				var flAuto = false;
				function doSearch(ev){
					if(!flAuto)
						return;
					// var elem = ev.target||ev.srcElement;
					if(timeoutHnd)
						clearTimeout(timeoutHnd);
					timeoutHnd = setTimeout(gridReload,500);
				}
				function gridReload(){
					var params=jQuery('#dummyParent_search').serialize();
					
					jQuery("#dummyParent_list2").setGridParam({url:"dummyParent/jsonList?"+params,page:1}).trigger("reloadGrid");
				}
				function enableAutosubmit(state){
					flAuto = state;
					jQuery("#dummyParent_button_search").attr("disabled",state);
				}

			
							
			--></script>
<!--js area end -->	

